const connection = require("../app/database")

class LabelService {
  async create(name){

    const statement = `INSERT INTO label (name) VALUES (?)`
    let [result] = await connection.promise().execute(statement,[name])

    return result
  }

  async getLabelByName(name){
    const statement = `SELECT * FROM label WHERE name = ?`
    const [result] = await connection.promise().execute(statement,[name])
    return result[0]
  }
}

module.exports = new LabelService()